import React from 'react';
import { Alert } from 'react-native';
import { Scene, Actions } from 'react-native-router-flux';
import user from '../../../common/models/user';
import navBarStyle from '../../../components/navBarStyle';
import Form from './Form';

const pressHandle = ({content}) => {
  user.updateSms(content).then(() => {
    Alert.alert('操作成功', `更新短信模板`, [
      { text: '返回', onPress: Actions.pop },
    ])
  });
};

module.exports = (
  <Scene
    key="editSmsTemplate"
    component={Form}
    title="更新短信模板"
    path="/smsTemplate/edit"
    user={user}
    hideTabBar
    onSubmit={pressHandle}
    {...navBarStyle}
  />
);
